package com.blog.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.blog.entity.Filter;
import com.blog.mapper.FileMapper;
import com.blog.service.FileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author blog
 * @since 2021-04-22
 */
@Service
public class FileServiceImpl extends ServiceImpl<FileMapper, Filter> implements FileService {

    private FileMapper fileMapper;

    @Autowired
    public FileServiceImpl(FileMapper fileMapper) {
        this.fileMapper = fileMapper;
    }

    @Override
    public PageInfo<Filter> getPageFilterList(Filter filter) {
        PageHelper.startPage(filter.getPage(),8);
        return new PageInfo<>(fileMapper.getFileList());
    }

    @Override
    public void delete(String img) {
        fileMapper.delete(img);
    }
}
